﻿using System;
using System.Collections.Generic;
using System.Linq;
using InvestmentIntelligence.DbModel.Models;

namespace InvestmentIntelligence.Data.Repository.EFImplementation
{
    public interface ITracePointRepository
    {
        List<T> GetList<T>(Func<IQueryable<TracePoint>, IEnumerable<T>> f, IEnumerable<int> investmentIds);
    }

    public class TracePointRepository : IIPRepository<TracePoint>, ITracePointRepository
    {
        public List<T> GetList<T>(Func<IQueryable<TracePoint>, IEnumerable<T>> f, IEnumerable<int> investmentIds)
        {
            return
                GetList(
                    dc => f(dc.Where(x => investmentIds.Contains(x.InvestmentId))));
        }
    }
}
